package model;

public abstract class Figure {

    private int con; // 玩家体质 (Constitution)
    private int dex; // 玩家敏捷 (Dexterity)
    private int str; // 玩家力量 (Strength)
    private int wis; // 玩家智慧 (Wisdom)
    private int hp, max_hp; // 玩家当前生命值和最大生命值
    private int nl, max_nl; // 玩家体力
    private int jl, max_jl; // 玩家能量
    private String name; // 人物名
    private String location; // 人物当前所在位置,room_id
    private int type;//判断NPC,怪和玩家的标志

    public Figure() {}

    public Figure( int con, int dex, int str, int wis, int hp, int max_hp, int nl, int max_nl, int jl, int max_jl, String username, String location,int type) {
        this.con = con;
        this.dex = dex;
        this.str = str;
        this.wis = wis;
        this.hp = hp;
        this.max_hp = max_hp;
        this.nl = nl;
        this.max_nl = max_nl;
        this.jl = jl;
        this.max_jl = max_jl; // 注意：这里应该是 `this.max_jl = max_jl;`，之前代码中写成了 `this.jl = jl;` 的重复赋值
        this.name = username;
        this.location = location;
        this.type = type;
    }

    public int getCon() {
        return con;
    }
    public void setCon(int con) {
        this.con = con;
    }
    public int getDex() {
        return dex;
    }
    public void setDex(int dex) {
        this.dex = dex;
    }
    public int getStr() {
        return str;
    }
    public void setStr(int str) {
        this.str = str;
    }
    public int getWis() {
        return wis;
    }
    public void setWis(int wis) {
        this.wis = wis;
    }
    public int getHp() {
        return hp;
    }
    public void setHp(int hp) {
        if(hp>max_hp){
            hp = max_hp;
        }
        else if(hp<0){
            hp = 0;
        }
        this.hp = hp;
    }
    public int getMax_hp() {
        return max_hp;
    }
    public void setMax_hp(int max_hp) {
        this.max_hp = max_hp;
    }
    public int getNl() {
        return nl;
    }
    public void setNl(int nl) {
        if(nl>max_nl){
            nl = max_nl;
        }
        else if(nl<0){
            nl = 0;
        }
        this.nl = nl;
    }
    public int getMax_nl() {
        return max_nl;
    }
    public void setMax_nl(int max_nl) {
        this.max_nl = max_nl;
    }
    public int getJl() {
        if(jl>max_jl){
            jl = max_jl;
        }
        else if(jl<0){
            jl = 0;
        }
        return jl;
    }
    public void setJl(int jl) {
        this.jl = jl;
    }
    public int getMax_jl() {
        return max_jl;
    }
    public void setMax_jl(int max_jl) {
        this.max_jl = max_jl;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getLocation() {
        return location;
    }
    public void setLocation(String location) {
        this.location = location;
    }
    public int getType() {
        return type;
    }

}
